package me.firstapp.common.utils;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;

public class ResponseUtils {
	public static void renderText(HttpServletResponse response, String msg) {
		try {
			response.setContentType("text/html;charset=UTF-8");
			response.setCharacterEncoding("UTF-8");
			response.getWriter().write(msg);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void renderJson(HttpServletResponse response, Object obj) {
		renderText(response, JSONObject.toJSONString(obj));
	}
}
